//
//  BankTableViewCell.swift
//  d11
//
//  Created by rhonin on 2018/11/4.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit
import SwiftyJSON
class BankTableViewCell: UITableViewCell {

    @IBOutlet weak var cardNum: UILabel!
    @IBOutlet weak var person: UILabel!
    @IBOutlet weak var name: UILabel!
    @IBOutlet weak var defLabel: UILabel!
    @IBOutlet weak var defImageView: UIImageView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.selectionStyle = .none
    }
    func configself(dic:JSON) {
        let string  = dic["cardnum"].stringValue
        let stringout = string.prefix(through: string.index(string.startIndex, offsetBy:string.count-5))
        let stringIn = string.suffix(from:  string.index(string.endIndex, offsetBy: -4))
        var stringReplcae = ""
        for _ in 0..<stringout.count {
            stringReplcae.append("*")
        }
        let defaultcard  = dic["defaultcard"].stringValue
        if defaultcard == "1"{
            //defLabel.isHidden = false
          //  defImageView.isHidden = false
            defImageView.image = UIImage.init(named: "check")
        }else{
            //defLabel.isHidden = true
           // defImageView.isHidden = true
            defImageView.image = UIImage.init(named: "no_check")
        }
        name.text = dic["bankname"].stringValue
        person.text = stringReplcae + stringIn
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
